package com.zoagroup.funzy.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * The persistent class for the type_user database table.
 * 
 */
@Entity
@Table(name="type_user")
public class TypeUser implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="id_type_user", unique=true, nullable=false)
	private Integer idTypeUser;

	private String description;

	@OneToMany(mappedBy="typeUserBean",cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	private List<User> users;
	
	public TypeUser() {
	}

	public Integer getIdTypeUser() {
		return this.idTypeUser;
	}

	public void setIdTypeUser(Integer idTypeUser) {
		this.idTypeUser = idTypeUser;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
	public List<User> getUsers() {
		return users;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((idTypeUser == null) ? 0 : idTypeUser.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		TypeUser other = (TypeUser) obj;
		if (idTypeUser == null) {
			if (other.idTypeUser != null)
				return false;
		} else if (!idTypeUser.equals(other.idTypeUser))
			return false;
		return true;
	}
}